<template>
    <br>
    <button @click="showName">点击</button>
    <br>
    <p1>姓名：{{ name }}</p1><br>
    <p1>年龄：{{ age }}</p1><br>
    <p1>性别：{{ p }}</p1><br>
</template>

<script lang="ts">
export default {
    name: 'Hello'
}
</script>

<!--setup语法糖-->
<script setup lang="ts">
import { ref, reactive,toRefs, toRef } from 'vue'

let person = reactive({name:'zs1',age:12})

let { name, age } = toRefs(person)

let p1 = 'zz'

let p = toRef(p1)


function showName() {
    name.value = 'zs'
    alert(name.value)
}
</script>